set(PDFVIEWER_PACKAGE_NAME "${PDFVIEWER_APPNAME}")

include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PDFVIEWER_APPNAME} is a program for viewing PDF files.")
set(CPACK_PACKAGE_VENDOR "Glad Deschrijver")
set(CPACK_PACKAGE_VERSION ${PDFVIEWER_VERSION})
string(REGEX REPLACE "\\..*" "" CPACK_PACKAGE_VERSION_MAJOR ${CPACK_PACKAGE_VERSION})
string(REGEX REPLACE "([0-9]*)\\.([0-9]*)(\\.([0-9]*))?" "\\2" CPACK_PACKAGE_VERSION_MINOR ${CPACK_PACKAGE_VERSION})
string(REGEX REPLACE "([0-9]*)\\.([0-9]*)(\\.)?" "" CPACK_PACKAGE_VERSION_PATCH ${CPACK_PACKAGE_VERSION})
if("${CPACK_PACKAGE_VERSION_PATCH}" STREQUAL "") # if ${CPACK_PACKAGE_VERSION} is of the form 0.10 instead of 0.10.3
	set(CPACK_PACKAGE_VERSION_PATCH "0")
endif("${CPACK_PACKAGE_VERSION_PATCH}" STREQUAL "")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PDFVIEWER_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.GPL2")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_IGNORE_FILES "/.svn/;/old/;/build*/*;/templates/;Makefile;~$;.qch$;.qhc$;/debian/;.exe$;snapshot.*png$")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_SET_DESTDIR TRUE)
#set(CPACK_STRIP_FILES "bin/pdfviewer")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libpoppler-qt4-3 (>=0.6)")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Glad Deschrijver <glad.deschrijver@gmail.com>")
set(CPACK_DEBIAN_PACKAGE_SECTION "graphics")
